\begin{lstlisting}
void adc_command(void)
{
  uint8_t arg1,arg2; 
  
  arg1=gpr_pointer[list_commands[pc].arg1];
  arg2=gpr_pointer[list_commands[pc].arg2];
  gpr_pointer[list_commands[pc].arg1]+=arg2;
  if(get_sreg_flag(FLAG_C)) 
    gpr_pointer[list_commands[pc].arg1]++;
  
  /* set bit, it means that field's value will be update */
  mem_file_changed[list_commands[pc].arg1/8]|=1<<list_commands[pc].arg1%8;
  
  check_Z_N_flags(gpr_pointer[list_commands[pc].arg1]);
  
  /* check flag C */
  if(((arg1&0x80)&(arg2&0x80))|
     ((arg1&0x80)&~(gpr_pointer[list_commands[pc].arg1]&0x80))|
     (~(gpr_pointer[list_commands[pc].arg1]&0x80)&
      (arg2&0x80)))
    set_sreg_flag(FLAG_C);
  else clear_sreg_flag(FLAG_C);

  /* check flag H */
  if(((arg1&0x08)&(arg2&0x08))|
     ((arg1&0x08)&~(gpr_pointer[list_commands[pc].arg1]&0x8))|
     (~(gpr_pointer[list_commands[pc].arg1]&0x08)&
      (arg2&0x08)))
   set_sreg_flag(FLAG_H);
  else clear_sreg_flag(FLAG_H);  

  /* check flag V */
  if(((arg1&0x80)&(arg2&0x80)&(~(gpr_pointer[list_commands[pc].arg1]&0x80)))|
     ((~(arg1&0x80))&(~(arg2&0x80))&(gpr_pointer[list_commands[pc].arg1]&0x80)))
    set_sreg_flag(FLAG_V);
  else clear_sreg_flag(FLAG_V);   
  
  /* check flag S */
  if(get_sreg_flag(FLAG_N)^get_sreg_flag(FLAG_V)) set_sreg_flag(FLAG_S);
  else clear_sreg_flag(FLAG_S);  
  pc++;
  clocks++;
}
\end{lstlisting}
